﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using Wicresoft.UnifyShow.Business;
using Wicresoft.UnifyShow.BusinessImpl;

namespace UnifyShowTest
{
    class TestCacheHelper
    {
        [Fact]
        public void TestGetKey()
        {
            List<string> list=new List<string>();
            for (int i = 0; i < 100; i++)
            {
                list.Add(i + "");
            }
            string key = CacheHelper.GetKey(typeof(string),"MethodName", DateTime.Now, 1.1, 1, "dfsfsd");
            CacheHelper.SetCache(key, list);
            var list1=(List<string>)CacheHelper.GetCache(key);
            Assert.Equal<string>(list, list1);
        }

        [Fact]
        public void TestGetKeyIfOneNull()
        {
            List<string> list = new List<string>();
            for (int i = 0; i < 100; i++)
            {
                list.Add(i + "");
            }
            string key = CacheHelper.GetKey(typeof(string), "MethodName", DateTime.Now, 1.1, 1, "dfsfsd", null);
            CacheHelper.SetCache(key, list);
            var list1 = (List<string>)CacheHelper.GetCache(key);
            Assert.Equal<string>(list, list1);
        }

    }
}
